<?php 

include '../function.php';
// include '../Modle.php';

// $modle = new Modle();
// $sql = "select * from stu where sex='女'";
// $res = $modle->query($sql);
// var_dump($res);

$dsn = "mysql:host=localhost;dbname=school";
$username="root";
$password = "";

try{

	$pdo = new Pdo($dsn,$username,$password);

}catch(PDOException $e) {

	die($e->getMessage());

}

$pdo->setAttribute(PDO::ATTR_ERRMODE,  PDO::ERRMODE_EXCEPTION);

// 设置统一的字符集
$pdo->query("SET NAMES utf8");

// 预准备
$sth = $pdo->prepare("SELECT * FROM stu WHERE  cid = ? AND age >=?");
// 设置参数
$cid = '1';
$age = '10';
// 绑定参数
$sth->bindParam(1, $cid, PDO::PARAM_STR);
$sth->bindParam(2, $age, PDO::PARAM_STR);
// 执行
$sth->execute();
// 返回结果集
$row = $sth->fetchAll();

var_dump($row);













 ?>